Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix package json node exports to solve types resolution problem and Bug fix preventing [^ref] from working properly for node. #44

Merged
merged 2 commits into from
Oct 10, 2024

Conversation

halafy-ds
Copy link
Contributor

  1. Problem with types file index.d.ts:

As per Node documentation the "types" entry field in package.json isn't used by the node runtime.
On Windows, vscode is complaining about decalaration file:

There are types at /node_modules/rehype-citation/dist/node/index.d.ts', but this result could not be resolved when respecting package.json "exports". the 'rehype-citation' library may need to update its package.json or typings.

As shown in Node documentation,

Since custom package conditions require clear definitions to ensure correct usage, a list of common known package conditions and their strict definitions is provided below to assist with ecosystem coordination.

"types" - can be used by typing systems to resolve the typing file for the given export. This condition should always be included first.

So we need to add index.d.ts file to exports to solve this problem., like below

  "exports": {
    ".": {
    + "types": "./dist/node/index.d.ts",
      "node": "./dist/node/rehype-citation.mjs",
      "default": "./dist/browser/rehype-citation.mjs"
    },
    ...
  }
  1. Bug: Problem with [^ref] not working on node.
    It's seems that the problem is due to a poorly positioned closing curly brace.

Copy link

netlify bot commented Oct 8, 2024

Deploy Preview for rehype-citation ready!

Name Link
🔨 Latest commit eb46715
🔍 Latest deploy log https://app.netlify.com/sites/rehype-citation/deploys/67048ca0b76a18000824193f
😎 Deploy Preview https://deploy-preview-44--rehype-citation.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@halafy-ds
Copy link
Contributor Author

Probably the fix of poorly positionned closing curly brace also Fixes #42.

@timlrx
Copy link
Owner

timlrx commented Oct 10, 2024

Thanks for the fix and for catching the curly braces issue. Not sure if it fixes the reference issue but I think the proposed changes make sense.

@timlrx timlrx merged commit 1fafdf6 into timlrx:main Oct 10, 2024
6 checks passed
@halafy-ds
Copy link
Contributor Author

I can confirm it fixes the ref issue. I've tested it on prod and it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants